#include <iostream>

using namespace std;

const int N = 125;

int maxv = -0x3f3f3f3f;

int n;
int s[N][N];

int main()
{
	scanf("%d", &n);
	
	for (int i = 1; i <= n; i ++ )
	{
		for (int j = 1; j <= n; j ++ )
		{
			int v;
			scanf("%d", &v);
			s[i][j] = v - s[i - 1][j - 1] + s[i - 1][j] + s[i][j - 1];
		}
	}
	
	for (int i = 1; i <= n; i ++ )
	{
		for (int j = 1; j <= n; j ++ )
		{
			for (int k = 1; k <= i; k ++ )
			{
				for (int l = 1; l <= j; l ++ )
				{
					if (i == k && j == l) continue;
					maxv = max(maxv, s[i][j] - s[k - 1][j] - s[i][l - 1] + s[k - 1][l - 1]);
				}
			}
		}
	}
	
	cout << maxv << endl;
	
	return 0;
} 	


